a11y: Remove AtkSelection implementation from combobox
authorBenjamin Otte <otte@redhat.com>
Thu, 2 May 2013 13:26:33 +0000 (15:26 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 2 May 2013 13:31:26 +0000 (15:31 +0200)
AtkSelection requires that the immediate children of the object are the
selectable items. The combobox however is implemented with just 1 child:
The popup menu.

The popup menu is implementing the selectable interface.

Test are updated to reflect this change.

gtk/a11y/gtkcomboboxaccessible.c
tests/a11y/combos.txt
tests/a11y/pickers.txt

index 385b26a7315f22d73fc80eeee1e563fb275c041b..94a53ea1c543685f5bad862865b4a13a896a2660 100644 (file)
@@ -29,11 +29,9 @@ struct _GtkComboBoxAccessiblePrivate
 };
 
 static void atk_action_interface_init    (AtkActionIface    *iface);
-static void atk_selection_interface_init (AtkSelectionIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GtkComboBoxAccessible, gtk_combo_box_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE,
-                         G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
-                         G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init))
+                         G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init))
 
 static void
 changed_cb (GtkWidget *widget)
@@ -52,7 +50,6 @@ changed_cb (GtkWidget *widget)
     {
       accessible->priv->old_selection = index;
       g_object_notify (G_OBJECT (obj), "accessible-name");
-      g_signal_emit_by_name (obj, "selection-changed");
     }
 }
 
@@ -333,106 +330,3 @@ atk_action_interface_init (AtkActionIface *iface)
   iface->get_localized_name = gtk_combo_box_accessible_action_get_localized_name;
   iface->get_description = gtk_combo_box_accessible_action_get_description;
 }
-
-static gboolean
-gtk_combo_box_accessible_add_selection (AtkSelection *selection,
-                                        gint          i)
-{
-  GtkWidget *widget;
-
-  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
-  if (widget == NULL)
-    return FALSE;
-
-  gtk_combo_box_set_active (GTK_COMBO_BOX (widget), i);
-
-  return TRUE;
-}
-
-static gboolean
-gtk_combo_box_accessible_clear_selection (AtkSelection *selection)
-{
-  GtkWidget *widget;
-
-  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
-  if (widget == NULL)
-    return FALSE;
-
-  gtk_combo_box_set_active (GTK_COMBO_BOX (widget), -1);
-
-  return TRUE;
-}
-
-static AtkObject *
-gtk_combo_box_accessible_ref_selection (AtkSelection *selection,
-                                        gint          i)
-{
-  GtkComboBox *combo_box;
-  GtkWidget *widget;
-  AtkObject *obj;
-  gint index;
-
-  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
-  if (widget == NULL)
-    return NULL;
-
-  if (i != 0)
-    return NULL;
-
-  combo_box = GTK_COMBO_BOX (widget);
-
-  obj = gtk_combo_box_get_popup_accessible (combo_box);
-  index = gtk_combo_box_get_active (combo_box);
-
-  return atk_object_ref_accessible_child (obj, index);
-}
-
-static gint
-gtk_combo_box_accessible_get_selection_count (AtkSelection *selection)
-{
-  GtkWidget *widget;
-
-  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
-  if (widget == NULL)
-    return 0;
-
-  return (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == -1) ? 0 : 1;
-}
-
-static gboolean
-gtk_combo_box_accessible_is_child_selected (AtkSelection *selection,
-                                            gint          i)
-{
-  GtkWidget *widget;
-  gint j;
-
-  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
-
-  if (widget == NULL)
-    return FALSE;
-
-  j = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
-
-  return (j == i);
-}
-
-static gboolean
-gtk_combo_box_accessible_remove_selection (AtkSelection *selection,
-                                           gint          i)
-{
-  if (atk_selection_is_child_selected (selection, i))
-    atk_selection_clear_selection (selection);
-
-  return TRUE;
-}
-
-static void
-atk_selection_interface_init (AtkSelectionIface *iface)
-{
-  iface->add_selection = gtk_combo_box_accessible_add_selection;
-  iface->clear_selection = gtk_combo_box_accessible_clear_selection;
-  iface->ref_selection = gtk_combo_box_accessible_ref_selection;
-  iface->get_selection_count = gtk_combo_box_accessible_get_selection_count;
-  iface->is_child_selected = gtk_combo_box_accessible_is_child_selected;
-  iface->remove_selection = gtk_combo_box_accessible_remove_selection;
-}
index e450993e07f74d5b28e14f84cd539a82e11942be..7bcd8e044af495bf38c9811f6423ce6443140b8a 100644 (file)
@@ -69,7 +69,6 @@ window1
       action 0 name: press
       action 0 description: Presses the combobox
       action 0 keybinding: <Alt>c
-      <AtkSelection>
       unnamed-GtkMenuAccessible-0
         "menu"
         parent: combo1
@@ -92,7 +91,6 @@ window1
       <AtkAction>
       action 0 name: press
       action 0 description: Presses the combobox
-      <AtkSelection>
       unnamed-GtkMenuAccessible-1
         "menu"
         parent: combo2
@@ -156,7 +154,6 @@ window1
       <AtkAction>
       action 0 name: press
       action 0 description: Presses the combobox
-      <AtkSelection>
       unnamed-GtkMenuAccessible-2
         "menu"
         parent: combo3
@@ -179,7 +176,6 @@ window1
       <AtkAction>
       action 0 name: press
       action 0 description: Presses the combobox
-      <AtkSelection>
       unnamed-GtkMenuAccessible-3
         "menu"
         parent: combo4
index 387b18f02ebb982b6db00b0f8e2ecec74320e911..237b1fcaa2676715f41a330aeb0482efd2a7adf5 100644 (file)
@@ -58,7 +58,6 @@ window1
       <AtkAction>
       action 0 name: press
       action 0 description: Presses the combobox
-      <AtkSelection>
       unnamed-GtkMenuAccessible-0
         "menu"
         parent: button1